import { Axios } from "axios";

/**
 * 基础数据响应结构
 */
export interface BaseResponse<T = undefined> {
  code: number;
  msg: string;
  data: T;
}

/**
 * 基础数据响应结构Promise包装
 */
export type Res<T = undefined, R = object> = Promise<BaseResponse<T> & R>;

export const http = new Axios({
  baseURL: "https://api.github.com",
  timeout: 12_000,
});
